package jdbc;

import java.io.File;
import java.util.List;

import com.swf.common.utils.FwsFileUtils;
import com.swf.common.utils.FwsPatternUtils;

public class ecs {
	private static String insert_sql = "INSERT INTO tpartnerfield(vc_partnerid,vc_bsntype,vc_cnname,vc_partnerfield,vc_standardfield) VALUES (allfields);";

	public static void main(String[] args) {
		File file = FwsFileUtils.getFile("jdbc/ecs.txt");
		String content;
		try {
			content = FwsFileUtils.loadFile(file, "GBK");
			List<String> list = FwsPatternUtils.matchedList(content, ".+");
			for (String s : list) {
				System.out.println(insert_sql.replace("allfields",
						getAllFields(s)));
			}
		} catch (Exception e) {

		}
	}

	private static String getAllFields(String s) {
		String[] fields = s.split("\\s+");
		StringBuffer sb = new StringBuffer();
		for (String filed : fields) {
			sb.append(",'" + filed + "'");
		}
		return "'bank','1'"+sb.toString() ;
	}
}
